<!--城乡房屋安全核查表-->
  <template>
    <div id="houseSafetyChecklist">
      <div class="JBXX">
        <p class="title">危改申请信息</p>
        <div class="JBXX" v-for="(item, index) in WGSQXX" :key="index">
          <p class="subTitle"><span class="line"></span>{{ item.name }}</p>
          <van-field v-for="(items, indexs) in item.children" :key="indexs" readonly v-model="JBXXform[items.key]"
            :label="items.name" />
        </div>
        <p class="title">与自建房数据库关联</p>
        <van-form ref="ruleFormZJF" :readonly="disabled" validate-firstm scroll-to-error>
          <van-field name="picker" :value="JBXXform.isChecked | inUseName(Enum.ISARR)" label="是否已排查入库" placeholder="请选择"
            @click="disabled ? '' : Enum.IS = true" clickable readonly />
          <van-popup v-model="Enum.IS" position="bottom">
            <van-picker value-key="name" title="是否已排查入库" show-toolbar :columns="Enum.ISARR" @confirm="onConfirmPCRK"
              @cancel="Enum.IS = false" />
          </van-popup>
          <van-field required v-model="JBXXform.checkNumber" label="自建房排查编号" :rules="ruleBlur">
            <template #button v-if="!disabled">
              <van-button size="mini" plain type="info" @click="retrieval(1)">检索</van-button>
            </template>
          </van-field>
        </van-form>
        <van-field readonly v-model="formDataZJF.belongCity" label="所属市" />
        <van-field readonly v-model="formDataZJF.belongCountry" label="所属区县" />
        <van-field readonly v-model="formDataZJF.belongTown" label="所属乡镇" />
        <van-field readonly v-model="formDataZJF.belongVillage" label="所属村" />
        <van-field readonly v-model="formDataZJF.address" label="房屋地址">
          <template #button>
            <img @click="showGeoZjf(formDataZJF.geomP)" style="margin-right: 4px" width="10"
              src="https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/YPC/dingwei.png" />
          </template>
        </van-field>
        <van-field readonly v-model="formDataZJF.cqr" label="产权人（使用人）姓名" />
        <van-field readonly v-model="formDataZJF.sfzh" label="身份证号" />
        <van-field readonly :value="formDataZJF.fwyt | inUseName(Enum.FWYT)" label="房屋用途" />
        <van-field readonly v-model="formDataZJF.cs" label="建筑层数" />
        <van-field readonly :value="formDataZJF.jzgn | inUseName(Enum.JTYT)" label="具体用途" />
        <van-field readonly :value="formDataZJF.jznd | inUseName(Enum.JZND)" label="建造年代" />
        <van-field readonly v-model="formDataZJF.dcmj" label="建筑面积" />
        <p class="title">农村房屋安全核查表</p>
        <p class="subTitle"><span class="line"></span>房屋基本信息（自动获取）</p>
        <van-form ref="ruleFormHCJBXX" :readonly="disabled" validate-firstm scroll-to-error>
          <van-field v-model="formData.inspectPerson" label="核查人" readonly />
          <van-field v-model="formData.inspectDate" label="核查时间" readonly />
          <van-field required name="picker" :value="formData.isHasHouse | inUseName(Enum.ISARRF)" label="是否为无房户"
            placeholder="请选择" @click="disabled ? '' : Enum.ISF = true" clickable readonly :rules="ruleBlur" />
          <van-popup v-model="Enum.ISF" position="bottom">
            <van-picker value-key="name" title="是否为无房户" show-toolbar :columns="Enum.ISARRF" @confirm="onConfirmSFWF"
              @cancel="Enum.ISF = false" />
          </van-popup>
        </van-form>
        <template v-if="formData.isHasHouse == 0 && formData.isHasHouse != null">
          <van-field :readonly="disabled" v-model="JBXXform.propertyPerson" label="户主姓名" />
          <van-field readonly v-model="JBXXform.householderIdcard" label="身份证号">
            <template #button v-if="!disabled">
              <van-button size="mini" plain type="info" @click="getfarmerHouseBypolice">核验</van-button>
            </template>
          </van-field>
          <van-field :readonly="disabled" type="number" v-model="JBXXform.housePersonNum" label="户内人数" />
          <van-field :readonly="disabled" type="number" v-model="JBXXform.houseMemberPersonNum" label="其中成员数" />
        </template>
        <template v-if="formData.isHasHouse == 1">
          <van-field readonly v-model="JBXXform.belongCity" label="所属市" />
          <van-field readonly v-model="JBXXform.belongCountry" label="所属区县" />
          <van-field readonly v-model="JBXXform.belongTown" label="所属乡镇" />
          <van-field readonly v-model="JBXXform.belongVillage" label="所属村" />
          <van-field readonly v-model="JBXXform.detailAddress" label="详细地址">
            <!-- <template #button>
              <img @click="showGeo()" style="margin-right: 4px" width="10"
                src="https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/YPC/dingwei.png" />
            </template> -->
          </van-field>
          <van-field :value="JBXXform.houseUsage | inUseName(Enum.FWYT)" label="房屋用途" placeholder="房屋用途"
            @click="disabled ? '' : Enum.ISFWYT = true" :readonly="disabled" />
          <van-popup v-model="Enum.ISFWYT" position="bottom">
            <van-picker value-key="name" title="房屋用途" show-toolbar :columns="Enum.FWYT" @confirm="onConfirmFWYT"
              @cancel="Enum.ISFWYT = false" />
          </van-popup>
          <van-field :value="houseDetailusage | inUseName1(Enum.JTYT)" label="具体用途" placeholder="请选择具体用途" clickable
            type="textarea" autosize @click="disabled ? '' : showPickerhouseDetailusage = true" :readonly="disabled" />
          <van-popup v-model="showPickerhouseDetailusage" position="bottom">
            <!-- <p class="titleBtn"><span @click="ENUM.TKBM = false" style="color: #969799">取消</span><van-checkbox v-model="checked" @change="toggleAll">全选</van-checkbox></p> -->
            <van-checkbox-group ref="checkboxGroup" v-model="HQRYMC" :style="{ height: '40vh', 'overflow-y': 'auto' }">
              <van-cell-group>
                <van-cell v-for="( item, index ) in Enum.JTYT" clickable :key="index" :title="item.name"
                  @click="toggle(index)">
                  <template #right-icon>
                    <van-checkbox :name="item.value" ref="checkboxes" />
                  </template>
                </van-cell>
              </van-cell-group>
            </van-checkbox-group>
            <!-- <van-picker value-key="name" title="具体用途" show-toolbar :columns="Enum.JTYT" @confirm="onConfirmhouseDetailusage"
            @cancel="showPickerhouseDetailusage = false" /> -->
          </van-popup>
          <van-field :readonly="disabled" v-model="JBXXform.propertyPerson" label="所有权人（使用人）姓名" />
          <van-field readonly v-model="JBXXform.householderIdcard" label="身份证号">
            <template #button v-if="!disabled">
              <van-button size="mini" plain type="info" @click="getfarmerHouseBypolice">核验</van-button>
            </template>
          </van-field>
          <van-field :readonly="disabled" type="number" v-model="JBXXform.housePersonNum" label="户内人数" />
          <van-field :readonly="disabled" type="number" v-model="JBXXform.houseMemberPersonNum" label="其中成员数" />
          <van-field :readonly="disabled" type="number" v-model="JBXXform.buildFloor" label="建筑层数(层)" />
          <van-field :readonly="disabled" type="number" v-model="JBXXform.buildArea" label="建筑面积(㎡)" />
          <van-field v-model="JBXXform.buildYear" label="建成时间（竣工时间）" @click="disabled ? '' : showPickerN = true"
            :readonly="disabled" />
          <van-popup v-model="showPickerN" position="bottom">
            <van-picker show-toolbar :columns="yearsToNow" @confirm="onConfirmN" @cancel="showPickerN = false" />
          </van-popup>
          <van-field :value="JBXXform.jglx | inUseName(Enum.JGLX)" label="结构类型" placeholder="结构类型"
            @click="disabled ? '' : Enum.ISJGLX = true" :readonly="disabled" />
          <van-popup v-model="Enum.ISJGLX" position="bottom">
            <van-picker value-key="name" title="结构类型" show-toolbar :columns="Enum.JGLX" @confirm="onConfirmJGLX"
              @cancel="Enum.ISJGLX = false" />
          </van-popup>
        </template>
        <p class="title">困难家庭信息</p>
        <van-form ref="ruleFormKNJT" :readonly="disabled" validate-firstm scroll-to-error>
          <van-field readonly v-model="JBXXform.userTypeFirst" label="是否困难家庭(来源于大数据接口)" />
          <van-field required v-model="KNJTform.userTypeOperation" label="是否修改" placeholder="是否修改"
            @click="disabled ? '' : showPicker1 = true" :readonly="disabled" :rules="ruleBlur" />
          <van-popup v-model="showPicker1" position="bottom">
            <van-picker value-key="name" title="是否修改" show-toolbar :columns="IswfhData" @confirm="onConfirm1"
              @cancel="showPicker1 = false" />
          </van-popup>
          <template v-if="KNJTform.userTypeOperation == '是'">
            <van-field required v-model="userType1" label="是否属于困难家庭" placeholder="是否属于困难家庭"
              @click="disabled ? '' : showPicker2 = true" :readonly="disabled" :rules="ruleBlur" />
            <van-popup v-model="showPicker2" position="bottom">
              <van-picker value-key="name" title="是否属于困难家庭" show-toolbar :columns="IswfhData" @confirm="onConfirm2"
                @cancel="showPicker2 = false" />
            </van-popup>
            <van-field v-if="userType1 == '是'" required v-model="difficultFamilyType" label="困难家庭类型" placeholder="困难家庭类型"
              @click="disabled ? '' : showPicker3 = true" :readonly="disabled" :rules="ruleBlur" />
            <van-popup v-model="showPicker3" position="bottom">
              <van-picker value-key="name" title="困难家庭类型" show-toolbar :columns="knjtLxData" @confirm="onConfirm3"
                @cancel="showPicker3 = false" />
            </van-popup>
            <van-field type="textarea" required v-model="KNJTform.remark" label="理由" placeholder="请输入内容" :rules="ruleBlur"
              :readonly="disabled" />
            <div v-for="( itemUrl, index ) in KNQZCLfile" :key="index">
              <div style="padding:10px" @click="getGroupGuids(itemUrl, fileList)">
                <div style="font-size: 14px;margin-bottom: 10px;">
                  <!-- <span style="color:red">*</span> -->
                  {{ itemUrl.name }}
                </div>
                <van-uploader :disabled="disabled" :after-read="afterRead" :before-delete="delectFile"
                  v-model="itemUrl.fileList" accept=".jpg,.gif,.png,.jpeg,.txt,.pdf,.doc,.docx,.xls,.xlsx">
                  <van-button icon="plus" type="info" plain size="mini">上传文件</van-button>
                </van-uploader>
              </div>
            </div>
          </template>
        </van-form>
      </div>
      <template v-if="formData.isHasHouse == 1">
        <div class="JBXX">
          <p class="subTitle"><span class="line"></span>闲置宅基地和房屋情况</p>
          <van-form ref="ruleFormXZQK" :readonly="disabled" validate-firstm scroll-to-error>
            <van-field v-model="formData.houseBaseArea" type="number" label="主房面积（㎡）" @input="houseBasefield" />
            <van-field v-model="formData.houseYardArea" type="number" label="庭院面积（㎡）" @input="houseBasefield1" />
            <van-field v-model="formData.houseAttachArea" type="number" label="附房面积（㎡）" @input="houseBasefield2" />
            <van-field v-model="formData.houseTotalArea" type="number" label="合计面积（㎡）" readonly />
          </van-form>
        </div>
        <div class="XCZK">
          <p class="subTitle"><span class="line"></span>危房整治情况</p>
          <van-checkbox-group v-model="JBXXform.houseRenovateStatus" :disabled="disabled">
            <van-checkbox style="margin-top:10px" :name=1 shape="square" @click="clickItem(1)">已鉴定，未完成治理</van-checkbox>
            <van-checkbox style="margin-top:10px" :name=2 shape="square" @click="clickItem(2)">已落实有效管控措施</van-checkbox>
            <van-checkbox style="margin-top:10px" :name=3 shape="square" @click="clickItem(3)">未悬挂符合要求的危房标识牌</van-checkbox>
            <van-checkbox style="margin-top:10px" :name=4 shape="square" @click="clickItem(4)">门窗未按要求封堵</van-checkbox>
            <van-checkbox style="margin-top:10px" :name=5 shape="square"
              @click="clickItem(5)">影响公共安全未落实有效安全措施</van-checkbox>
            <van-checkbox style="margin-top:10px" :name=6 shape="square"
              @click="clickItem(6)">已完成修缮加固</van-checkbox>
          </van-checkbox-group>
        </div>
        <div class="XCZK" v-if="!JBXXform.houseRenovateStatus || JBXXform.houseRenovateStatus.length == []">
          <p class="subTitle"><span class="line"></span>现场状况</p>
          <div v-for="( item, index ) in  XCZKList" :key="index">
            <p class="subtitle">
              {{ item.name }}
            </p>
            <van-checkbox-group v-if="item.name != '危房治理'" v-model="item.valueYC" :disabled="disabled">
              <van-checkbox name="0" shape="square" @click="handleRadioChange(item)">无异常</van-checkbox>
            </van-checkbox-group>
            <van-checkbox-group :ref="'checkboxGroup' + index" v-model="item.value" :disabled="disabled">
              <van-checkbox shape="square" @click="handleCheckedChange(item)" v-for="( items, index ) in  item.children "
                :key="index" :name="items.value" style="margin-top:10px">{{
                  items.name }}</van-checkbox>
            </van-checkbox-group>
          </div>
        </div>
        <div class="XCZK">
          <p class="title">排查结论</p>
          <van-form ref="ruleFormzp"
            :disabled="disabled || JBXXform.houseRenovateStatus && JBXXform.houseRenovateStatus.length > 0" validate-firstm
            scroll-to-error>
            <van-field name="radio" required label="初步判定" :rules="ruleChange">
              <template #input>
                <van-radio-group v-model="formData.firstJudge">
                  <van-radio :name="0" style="margin-bottom: 10px;">基本安全</van-radio>
                  <van-radio :name="1" style="margin-bottom: 10px;">存在安全隐患（需要安全鉴定）</van-radio>
                  <!-- <van-radio :name="2" style="margin-bottom: 10px;">无房</van-radio> -->
                  <van-radio :name="3" style="margin-bottom: 10px;">危房正在整治中</van-radio>
                  <van-radio :name="4" style="margin-bottom: 10px;">已拆除</van-radio>
                </van-radio-group>
              </template>
            </van-field>
          </van-form>
        </div>
        <div v-if="formData.firstJudge == 1">
          <p class="subTitle"><span class="line"></span>鉴定整治方式</p>
          <van-form ref="ruleFormZZFS" :readonly="disabled" validate-firstm scroll-to-error>
            <van-field required name="picker" :value="JBXXform.appraiseFirst | inUseName(Enum.JDJG)" label="鉴定机构"
              placeholder="请选择" @click="disabled ? '' : Enum.ISJDJG = true" clickable readonly :rules="ruleBlur" />
            <van-popup v-model="Enum.ISJDJG" position="bottom">
              <van-picker value-key="name" title="鉴定机构" show-toolbar :columns="Enum.JDJG" @confirm="onConfirmJDJG"
                @cancel="Enum.ISJDJG = false" />
            </van-popup>
            <template v-if="JBXXform.appraiseFirst == 0">
              <van-field required name="picker" v-if="JBXXform.appraiseFirst == 0" :value="JBXXform.usccName" label="鉴定机构名称"
                placeholder="请选择" @click="disabled ? '' : Enum.ISJDDJ = true" clickable readonly :rules="ruleBlur" />
              <van-popup v-model="Enum.ISJDDJ" position="bottom">
                <van-picker value-key="qymc" title="鉴定机构名称" show-toolbar :columns="Enum.JDDJ" @confirm="onConfirmJDDJ"
                  @cancel="Enum.ISJDDJ = false" />
              </van-popup>
              <van-field v-model="JBXXform.uscc" label="统一社会信用代码" readonly />
            </template>
            <van-field required name="picker" :value="JBXXform.removeDangerMode" label="整治方式" placeholder="请选择"
              @click="disabled ? '' : Enum.ISZZFS = true" clickable readonly :rules="ruleBlur" />
            <van-popup v-model="Enum.ISZZFS" position="bottom">
              <van-picker title="整治方式" show-toolbar
                :columns="['腾空防控', '监控使用', '维修加固', '拆除重建', '拆除灭失', '拆除安置', '置换安置', '租用安置']"
                @confirm="(val) => { JBXXform.removeDangerMode = val; Enum.ISZZFS = false }"
                @cancel="Enum.ISZZFS = false" />
            </van-popup>
          </van-form>
        </div>
        <div v-for="( itemUrl, index ) in  fileList" :key="index">
          <div style="padding:10px" @click="getGroupGuids(itemUrl, fileList)">
            <div style="margin:10px 0px 0px 10px;font-size: 14px;margin-bottom: 10px;">
              <span style="color:red" v-if="itemUrl.isHas">*</span>
              {{ itemUrl.name }}
            </div>
            <van-uploader :disabled="disabled" :after-read="afterRead" :before-delete="delectFile"
              v-model="itemUrl.fileList" accept=".jpg,.gif,.png,.jpeg" />
          </div>
        </div>
      </template>
    </div>
  </template>
  
  <script>
  import axios from "axios";
  import {
    ossUploadFiles,
    FileServerProxy,
    ossdelteFiles,
    getZjfGeomP,
    getDifficultFamilies,
    savePatrolHouseInfo,
    numGenerateGetNum,
    getPoliceData
  } from '@/utils/api'
  import { Dialog } from 'vant';
  export default {
    props: {
      objectNo: String,
      disabled: Boolean,
      rowData: Object
    },
    name: "houseSafetyChecklist",
    data() {
      return {
        IsWGXC: true,
        yearsToNow: [],
        showPickerN: false,
        showPickerhouseDetailusage: false,
        houseDetailusage: [],
        HQRYMC: [],
        JBXXform: {},
        WGSQXX: [{
          name: "申请人信息",
          children: [{
            name: '申请人名字',
            key: 'applyUser',
          }, {
            name: '身份证号',
            key: 'applyIdcard',
          }, {
            name: '手机号',
            key: 'applyPhone',
          }]
        }, {
          name: "房屋信息",
          children: [{
            name: '所属地市',
            key: 'belongCity',
          }, {
            name: '所属区县',
            key: 'belongCountry',
          }, {
            name: '所属乡镇',
            key: 'belongTown',
          }, {
            name: '所属村',
            key: 'belongVillage',
          }, {
            name: '详细地址',
            key: 'detailAddress',
          }, {
            name: '建筑层数',
            key: 'buildFloor',
          }]
        }],
        showPickerhouseUsage: false,
        difficultFamilyType: '',
        KNJTform: {
          remark: '',
          userType: '',
          difficultFamilyType: '',
          objectNo: '',
          userTypeOperation: '',
          userName: '',
          userId: '',
          fileGroupGuid: '',
        },
        userType1: '',
        showPickerq: false,
        knjtLxData: [
          {
            name: '低保户',
            val: '1'
          }, {
            name: '分散供养特困人员',
            val: '2'
          }, {
            name: '贫困残疾人家庭',
            val: '3'
          }, {
            name: '低保边缘户',
            val: '4'
          }
        ],
        IswfhData: [
          {
            name: '是',
            val: 0
          }, {
            name: '否',
            val: 1
          }
        ],
        showPicker1: false,
        showPicker2: false,
        showPicker3: false,
        BaseURL: window.g.BaseURL,
        JBXXform: {
          appraiseFirst: "",
          propertyPerson: "",
          householderIdcard: "",
          buildFloor: "",
          buildYear: "",
          belongCity: "",
          belongCounty: "",
          belongTown: "",
          belongVillage: "",
          detailAddress: "",
          buildArea: "",
          homesteadArea: "",
          houseUsage: "",
          isExpansion: "",
          safetyLevel: "",
          isTkFk: "",
          houseType: "",
          userTypeFirst: '',
          patrolProcessNode: 0,
          objectNo: "",
          birthplace: "",
          houseMemberPersonNum: "",
          housePersonNum: "",
          jglx: "",
          houseDetailusage: "",
          usccName: "",
          uscc: "",
          isChecked: "",
          houseRenovateStatus: [],
        },
        userType: '',
        XCZKList: [{
          name: "周边情况",
          key: 'buildEnums',
          valueYC: [],
          value: [],
          children: [
            {
              name: '房屋周边地面长期积水',
              value: '1'
            },
            {
              name: '房屋周边有工程建设和深基坑施工情况',
              value: '2'
            },
            {
              name: '房屋周边有影响安全的危险因素（例如山体滑坡等）',
              value: '3'
            },
            {
              name: '有破墙开门、开窗或开店等影响结构安全的行为，或其他改变使用功能有较大变动情况',
              value: '4'
            },
            // {
            //   name: '基础局部或塌陷的',
            //   value: '5'
            // },
            // {
            //   name: '房屋周边有影响安全的危险因素（例如山体滑坡等）',
            //   value: '6'
            // },
            // {
            //   name: '有破墙开门、开窗或开店等影响结构安全的行为，或其他改变使用功能有较大变动情况',
            //   value: '7'
            // }
          ]
        }, {
          name: "地基基础",
          key: 'baseEnums',
          valueYC: [],
          value: [],
          children: [
            {
              name: '房屋出现明显不均匀沉降（斜向）裂缝',
              value: '1'
            },
            {
              name: '外露基础明显腐蚀、酥碱、松散和剥落',
              value: '2'
            },
            {
              name: '裂缝持续发展尚未稳定',
              value: '3'
            },
            {
              name: '出现明显倾斜',
              value: '4'
            },
            {
              name: '基础局部或整体塌陷的',
              value: '5'
            },
            {
              name: '局部被架空',
              value: '6'
            }
          ]
        }, {
          name: "改扩建",
          key: 'rebuildEnums',
          valueYC: [],
          value: [],
          children: [
            {
              name: '楼屋面使用荷载大幅增加',
              value: '1'
            },
            {
              name: '在原楼屋面新增的架空层',
              value: '2'
            },
            {
              name: '擅自拆改主体结构',
              value: '3'
            },
            {
              name: '擅自开挖地下空间',
              value: '4'
            }
          ]
        }, {
          name: "墙体",
          key: 'liveBrickEnums',
          valueYC: [],
          value: [],
          children: [
            {
              name: '墙体开裂严重',
              value: '1'
            },
            {
              name: '墙体有歪斜',
              value: '2'
            },
            {
              name: '局部倒塌或有倒坍危险',
              value: '3'
            }
          ]
        }, {
          name: "柱、梁、板",
          key: 'livePillarsEnums',
          valueYC: [],
          value: [],
          children: [
            {
              name: '保护层剥落严重',
              value: '1'
            },
            {
              name: '钢筋漏筋、锈蚀，出现明显锈胀裂缝',
              value: '2'
            },
            {
              name: '梁柱出现明显受力裂缝和变形',
              value: '3'
            },
          ]
        }, {
          name: "楼屋面",
          key: 'liveFloorEnums',
          valueYC: [],
          value: [],
          children: [
            {
              name: '明显变形',
              value: '1'
            },
            {
              name: '明显裂缝',
              value: '2'
            },
            {
              name: '较严重渗漏',
              value: '3'
            },
            {
              name: '老化破损',
              value: '4'
            },
          ]
        }, {
          name: "木架构",
          key: 'liveWoodEnums',
          valueYC: [],
          value: [],
          children: [
            {
              name: '明显腐朽或虫蛀',
              value: '1'
            },
            {
              name: '梁、檩跨中明显变形或出现横向裂缝',
              value: '2'
            },
            {
              name: '梁、檩端部出现劈裂',
              value: '3'
            },
            {
              name: '柱身明显歪斜',
              value: '4'
            },
            {
              name: '木柱与柱基础之间错位',
              value: '5'
            },
            {
              name: '构件纵向有明显干缩裂缝',
              value: '6'
            },
            {
              name: '卯榫节点有破损或有拔榫迹象',
              value: '7'
            },
            {
              name: '承重柱存在接柱或转换情况且未采取可靠连接措施',
              value: '8'
            },
          ]
        }],
        formData: {
          "firstJudge": "",
          "id": "",
          "inspectDate": "",
          "inspectPerson": "",
          "baseEnums": "",
          "buildEnums": "",
          "liveBrickEnums": "",
          "liveFloorEnums": "",
          "livePillarsEnums": "",
          "liveWoodEnums": "",
          "objectNo": "",
          "isHasHouse": null,
          "opinion": "",
          "noHouseFileGroupId": "",
          "houseAttachArea": "",
          "houseBaseArea": "",
          "houseTotalArea": "",
          "houseYardArea": "",
          "repairHouseEnums": "",
          "rebuildEnums": "",
        },
        KNQZCLfile: [{
          name: '困难群众证明材料',
          groupGuid: '',
          fileList: [],
        }],
        fileList: [
          {
            name: '安全隐患通知书照片',
            groupGuid: '',
            isHas: false,
            fileList: [],
            type: 'img'
          },
          {
            name: '房屋照片',
            groupGuid: '',
            isHas: true, //是否必传
            fileList: [],
            type: 'img'
          },
        ],
        formDataZJF: [],
        Enum: {
          ISJDJG: false,
          JDJG: [{
            name: '无需鉴定',
            value: 1
          }, {
            name: '需要鉴定',
            value: 0
          }],
          ISFWYT: false,
          FWYT: [{
            name: '经营性自建房',
            value: 1
          }, {
            name: '其他自建房',
            value: 2
          }],
          ISJTYT: false,
          JTYT: [{
            name: '餐饮饭店',
            value: '1'
          },
          {
            name: '民宿宾馆',
            value: '2'
          },
          {
            name: '批发零售',
            value: '3'
          },
          {
            name: '医疗卫生',
            value: '4'
          },
          {
            name: '养老服务',
            value: '5'
          },
          {
            name: '生产加工',
            value: '6'
          },
          {
            name: '仓储物流',
            value: '7'
          },
          {
            name: '出租居住',
            value: '8'
          },
          {
            name: '休闲娱乐',
            value: '9'
          },
          {
            name: '教育培训',
            value: '10'
          },
          {
            name: '商务办公',
            value: '11'
          },
          {
            name: '农贸市场',
            value: '12'
          },
          {
            name: '宗教场所',
            value: '13'
          },
          {
            name: '其他',
            value: '99'
          }],
          ISJGLX: false,
          JGLX: [{
            name: '砌体结构',
            value: '1'
          },
          {
            name: '底部框架-上部砌体结构',
            value: '2'
          },
          {
            name: '钢筋混凝土结构',
            value: '3'
          },
          {
            name: '钢结构',
            value: '4'
          },
          {
            name: '木 (竹) 结构',
            value: '5'
          },
          {
            name: '窑洞',
            value: '6'
          },
          {
            name: '混杂结构',
            value: '7'
          },
          {
            name: '土木/石木结构',
            value: '8'
          },
          {
            name: '其他',
            value: '99'
          }
          ],
          JZND: [{
            name: '1980年及以前',
            value: 1
          }, {
            name: '1981-1990年',
            value: 2
          }, {
            name: '1991-2000年',
            value: 3
          }, {
            name: '2001-2010年',
            value: 4
          }, {
            name: '2011-2015年',
            value: 5
          }, {
            name: '2016年及以后',
            value: 6
          }],
          ISJDDJ: false,
          JDDJ: [],
          ISZZFS: false,
          ISARR: [{
            name: '是',
            value: 1
          }, {
            name: '否',
            value: 0
          }],
          IS: false,
          ISARRF: [{
            name: '是',
            value: 0
          }, {
            name: '否',
            value: 1
          }],
          ISF: false,
        },
        ruleBlur: [{ required: true, message: ' ', trigger: "blur" }],
        ruleChange: [{ required: true, message: ' ', trigger: "change" }],
      }
    },
    watch: {
      HQRYMC() {
        this.houseDetailusage = this.HQRYMC
      },
      'formData.firstJudge': function () {
        this.formData.firstJudge == 1 ? this.fileList[0].isHas = true : this.fileList[0].isHas = false;
      },
      'JBXXform.houseRenovateStatus': function () {
        this.JBXXform.houseRenovateStatus && this.JBXXform.houseRenovateStatus.length > 0 ? this.formData.firstJudge = 3 : "";
      }
    },
    filters: {
      inUseName: function (msg, data) {
        let name = ''
        data.forEach((item) => {
          if (item.value == msg) {
            name = item.name
          }
        })
        return name
      },
      inUseName1: function (msg, data) {
        try {
          let arr1 = []
          data.forEach((item) => {
            msg.forEach((items) => {
              if (item.value == items) {
                arr1.push(item.name)
              }
            })
          })
          return arr1.join(',')
        } catch (err) { }
      },
    },
    methods: {
      //查询鉴定机构下拉内容
      getEnum: async function () {
        let parm = {
          "belongCountryList": [],
          "belongCountyList": [],
          "name": "",
          "pageNo": 1,
          "fwlx": "鉴定机构",
          "pageSize": 100000
        }
        let webResult = await axios.post(this.BaseURL + '/api/farmerHouse/zhejiangHouseTechnicalUnit/selectTechnicalList', parm, {
          headers: {
            isOutParam: true,
          },
        });
        this.Enum.JDDJ = webResult.data.data.pageList
      },
      //检索
      retrieval: async function (state) {
        if (state && !this.JBXXform.checkNumber) {
          this.$toast.fail("请输入自建房排查编号！");
          return false
        }
        if (this.JBXXform.checkNumber) {
          let res = await axios.post(this.BaseURL + '/api/farmerHouse/tFwZjfNew/query', { yhfwbh: this.JBXXform.checkNumber }, {
            headers: {
              isOutParam: true,
            },
          });
          if (res.data.data && res.data.data.length > 0) {
            this.formDataZJF = res.data.data[0]
          } else {
            if (state) {
              Dialog.confirm({
                message: `当前自建房排查编号${this.JBXXform.checkNumber}未查询到需要关联的自建房数据,排查编号是否需要自动生成?`,
              }).then(() => {
                this.getLSH()
              })
            }
          }
        }
      },
      // 获取流水号
      async getLSH() {
        let date = new Date()
        let year = date.getFullYear()
        let params = {
          appKey: '6738b790-69e8-11ec-a673-6805cab640z1',
          accessCode: 'b03be941dc27498ebcc46311330ee97d',
          keyType: '3',
          numPrefix: 'WGSQ-' + this.JBXXform.cityCode,
          year: year //当前年份
        }
        const res = await numGenerateGetNum(params)
        if (res.data.code == 200) {
          this.JBXXform.checkNumber = res.data.data
        } else {
          this.$toast.fail('获取失败')
        }
      },
      round(num) {
        const factor = Math.pow(10, 3);
        return Math.round(num * factor) / factor;
      },
      houseBasefield(val) {
        this.formData.houseTotalArea = this.round(Number(this.formData.houseBaseArea) + Number(this.formData.houseYardArea) + Number(this.formData.houseAttachArea))
      },
      houseBasefield1(val) {
        this.formData.houseTotalArea = this.round(Number(this.formData.houseBaseArea) + Number(this.formData.houseYardArea) + Number(this.formData.houseAttachArea))
      },
      houseBasefield2(val) {
        this.formData.houseTotalArea = this.round(Number(this.formData.houseBaseArea) + Number(this.formData.houseYardArea) + Number(this.formData.houseAttachArea))
      },
      getfarmerHouseBypolice: async function () {
        let params = {
          accessCode: 'a02f84a3615d11ec87416805cab640a0',
          cityCode: window.localStorage.getItem("citycode"),
          appKey: '6738b790-69e8-11ec-a673-6805cab640a0',
          params: { czrkgmsfhm: this.JBXXform.householderIdcard },
        }
        const res1 = await getPoliceData(params)
        if (res1.data.code == '200' && res1.data.data.datas && JSON.parse(res1.data.data.datas).length > 0) {
          this.isyezz = true
          this.JBXXform.propertyPerson = JSON.parse(res1.data.data.datas)[0].ELC_LICENCE_STRUCT.DATA.NAME
        } else {
          this.isyezz = false
        }
        if (this.isyezz) {
          this.$toast.success('核验成功!')
        } else {
          Dialog.alert({
            title: '提示',
            message: '大数据未查询到数据，请人工校验身份信息是否一致！',
          }).then(() => {
          })
        }
      },
      toggle(index) {
        this.$refs.checkboxes[index].toggle()
      },
      onConfirmN(data) {
        this.JBXXform.buildYear = data
        this.showPickerN = false
      },
      getYearsToNow() {
        this.yearsToNow = []
        // this.yearsToNow=[2020,2021,2022]
        //获取到从那一年开始
        let smallYears = 1970
        //获取当前时间
        let date = new Date()
        let nowYears = date.getFullYear()
        let Years = nowYears - smallYears
        let arrYear = []
        for (let i = 0; i <= Years; i++) {
          arrYear.push(nowYears--)
        }
        arrYear.forEach((item) => {
          //下拉框的数组
          this.yearsToNow.push(item)
        })
      },
      //定位
      showGeo: async function () {
        let webResult = await axios.get(this.BaseURL + '/api/farmerHouse/tfwZjf/getZjfGeomP?yhfwbh=' + this.rowData.checkNumber, {
          headers: {
            isOutParam: true,
          },
        });
        if (webResult.data.data && webResult.data.data.length > 0) {
          let dataValue = [{ "geomP": webResult.data.data[0] }]
          var url = window.g.oneMapUrlLocation + "?user=" + window.localStorage.getItem("citycode") + "&data=" + encodeURIComponent(JSON.stringify(dataValue))
          window.open(url)
        } else {
          this.$toast.fail("坐标不能为空!")
        }
  
      },
      //自建房定位
      showGeoZjf: async function (geomP) {
        if (geomP) {
          let dataValue = [{ "geomP": geomP }]
          var url = window.g.oneMapUrlLocation + "?user=" + window.localStorage.getItem("citycode") + "&data=" + encodeURIComponent(JSON.stringify(dataValue))
          window.open(url)
        } else {
          this.$toast.fail("坐标不能为空!")
        }
  
      },
      //鉴定机构选中
      onConfirmJDJG(val) {
        this.JBXXform.appraiseFirst = val.value;
        this.Enum.ISJDJG = false
      },
      //鉴定机构名称选中
      onConfirmJDDJ(val) {
        this.JBXXform.usccName = val.qymc;
        this.JBXXform.uscc = val.zzjgdm;
        this.Enum.ISJDDJ = false;
      },
      //是否已排查入库
      onConfirmPCRK(val) {
        debugger
        this.JBXXform.isChecked = val.value;
        this.Enum.IS = false;
      },
      //是否为无房户
      onConfirmSFWF(val) {
        this.formData.isHasHouse = val.value;
        this.Enum.ISF = false;
      },
      // 房屋用途
      onConfirmFWYT(val) {
        this.JBXXform.houseUsage = val.value
        this.Enum.ISFWYT = false
      },
      //结构类型
      onConfirmJGLX(val) {
        this.JBXXform.jglx = val.value
        this.Enum.ISJGLX = false
      },
      // 取消选中
      clickItem(value) {
        if (this.JBXXform.houseRenovateStatus.length > 0) {
          this.JBXXform.houseRenovateStatus = [value]
        } else {
          this.formData.firstJudge = null
        }
      },
      onConfirmhouseDetailusage(val) {
        this.houseDetailusage = val.name
        this.JBXXform.houseDetailusage = val.value
        this.showPickerhouseDetailusage = false
      },
      onConfirmRQ(val) {
        let year = val.getFullYear()
        let month = val.getMonth() + 1
        let day = val.getDate()
        let hour = val.getHours()
        let minute = val.getMinutes()
        if (month >= 1 && month <= 9) {
          month = `0${month}`
        }
        if (day >= 1 && day <= 9) {
          day = `0${day}`
        }
        if (hour >= 0 && hour <= 9) {
          hour = `0${hour}`
        }
        if (minute >= 0 && minute <= 9) {
          minute = `0${minute}`
        }
        this.formData.inspectDate = `${year}-${month}-${day}`
        this.showPickerq = false
      },
      onConfirm1(val) {
        this.KNJTform.userTypeOperation = val.name
        this.showPicker1 = false
      },
      onConfirm2(val) {
        this.userType1 = val.name
        if (val.name == '是') {
          this.KNJTform.userType = 1
        } else if (val.name == '否') {
          this.KNJTform.userType = 0
          this.difficultFamilyType = ''
          this.KNJTform.difficultFamilyType = ''
        }
        this.showPicker2 = false
      },
      onConfirm3(val) {
        this.difficultFamilyType = val.name
        this.KNJTform.difficultFamilyType = val.val
        this.showPicker3 = false
      },
      getData: async function () {
        if (this.objectNo || window.sessionStorage.getItem('objectNo')) {
          let parm = {
            objectNo: this.objectNo || window.sessionStorage.getItem('objectNo')
          }
          let res = await axios.post(this.BaseURL + '/api/farmerHouse/housePatrol/getHouseBaseInfo', parm, {
            headers: {
              isOutParam: true,
            },
          });
          if (res.data.data) {
            this.JBXXform = res.data.data;
            this.retrieval()
            if (this.JBXXform.houseRenovateStatus) {
              this.JBXXform.houseRenovateStatus = [this.JBXXform.houseRenovateStatus]
            } else {
              this.JBXXform.houseRenovateStatus = []
            }
            if (this.JBXXform.houseDetailusage != '' && this.JBXXform.houseDetailusage != null) {
              this.houseDetailusage = this.HQRYMC = this.JBXXform.houseDetailusage.split(',').map(String)
            }
            if (this.JBXXform.userTypeFirst == '' || this.JBXXform.userTypeFirst == null) {
              setTimeout(() => {
                this.getDifficultNew(this.JBXXform.householderIdcard)
              }, 1000)
            } else {
              if (this.JBXXform.userTypeFirst == 0) {
                this.JBXXform.userTypeFirst = '否'
              } else if (this.JBXXform.userTypeFirst == 1) {
                this.JBXXform.userTypeFirst = '是'
              }
            }
          } else {
            for (var i in this.JBXXform) {
              this.JBXXform[i] = null
            }
          }
  
          let webResult2 = await axios.get(this.BaseURL + '/api/farmerHouse/dangerHouseRemold/getUserTypeRemarkNewV2?objectNo=' + this.objectNo, {
            headers: {
              isOutParam: true,
            },
          });
          if (webResult2.data && webResult2.data.data) {
            this.KNJTform.userType = webResult2.data.data.userType;
            if (this.KNJTform.userType == 0) {
              this.userType1 = '否'
            } else if (this.KNJTform.userType == 1) {
              this.userType1 = '是'
            }
            this.KNJTform.remark = webResult2.data.data.remark;
            this.KNJTform.difficultFamilyType = webResult2.data.data.difficultFamilyType;
            if (this.KNJTform.difficultFamilyType == 1) {
              this.difficultFamilyType = '低保户';
            } else if (this.KNJTform.difficultFamilyType == 2) {
              this.difficultFamilyType = '分散供养特困人员';
            } else if (this.KNJTform.difficultFamilyType == 3) {
              this.difficultFamilyType = '贫困残疾人家庭';
            } else if (this.KNJTform.difficultFamilyType == 4) {
              this.difficultFamilyType = '低保边缘户';
            }
            this.KNJTform.userTypeOperation = webResult2.data.data.userTypeOperation;
            if (webResult2.data.data.fileGroupGuid) {
              this.KNJTform.fileGroupGuid = webResult2.data.data.fileGroupGuid;
              this.KNQZCLfile[0].groupGuid = webResult2.data.data.fileGroupGuid;
            }
  
            if (webResult2.data.data.fileGroupList && webResult2.data.data.fileGroupList.length > 0) {
              webResult2.data.data.fileGroupList.forEach((item) => {
                if (window.g.IsEnabled == "1") {
                  this.KNQZCLfile[0].fileList.push({
                    id: item.id,
                    url: window.g.OSSPriview + item.fileUrl,
                    isImage: true,
                    name: item.fileName,
                  })
                } else {
                  this.KNQZCLfile[0].fileList.push({
                    id: item.id,
                    url: window.g.BaseURL + 'api/upload/oss/preview?fileId=' + item.id,
                    isImage: true,
                    name: item.fileName,
                  })
                }
              })
            }
          }
          let webResult = await axios.post(this.BaseURL + '/api/farmerHouse/houseInspect/getInspectDetailInfo', parm, {
            headers: {
              isOutParam: true,
            },
          });
          if (webResult.data.data) {
            this.formData = webResult.data.data
            // this.formData.inspectPerson = JSON.parse(window.localStorage.getItem("userName")).userName;
            if (this.rowData.patrolProcessNode == 1) {
              this.formData.inspectDate = this.getDate();
            }
            for (var k in this.formData) {
              this.XCZKList.forEach(item => {
                if (k == item.key && this.formData[item.key] !== '') {
                  if (this.formData[item.key] == "0") {
                    item.valueYC = this.formData[item.key].split(",")
                  } else if (this.formData[item.key]) {
                    item.value = this.formData[item.key].split(",")
                  }
                }
              })
            }
            this.formData.houseTotalArea = Number(this.formData.houseBaseArea) + Number(this.formData.houseYardArea) + Number(this.formData.houseAttachArea)
            //this.formData.fileGroupId ? this.fileList[0].groupGuid = this.formData.fileGroupId : "";
            this.formData.safetyPatrolPictures ? this.fileList[0].groupGuid = this.formData.safetyPatrolPictures : "";
            if (webResult.data.data.safetyPatrolPictureList && webResult.data.data.safetyPatrolPictureList.length > 0) {
              webResult.data.data.safetyPatrolPictureList.forEach(item => {
                if (window.g.IsEnabled == "1") {
                  this.fileList[0].fileList.push({
                    id: item.id,
                    url: window.g.OSSPriview + item.fileUrl,
                    isImage: true,
                    name: item.fileName,
                  })
                } else {
                  this.fileList[0].fileList.push({
                    id: item.id,
                    url: window.g.BaseURL + 'api/upload/oss/preview?fileId=' + item.id,
                    isImage: true,
                    name: item.fileName,
                  })
                }
              })
            }
            this.formData.fileGroupId ? this.fileList[1].groupGuid = this.formData.fileGroupId : "";
            if (webResult.data.data.fileGroupList && webResult.data.data.fileGroupList.length > 0) {
              webResult.data.data.fileGroupList.forEach(item => {
                if (window.g.IsEnabled == "1") {
                  this.fileList[1].fileList.push({
                    id: item.id,
                    url: window.g.OSSPriview + item.fileUrl,
                    isImage: true,
                    name: item.fileName,
                  })
                } else {
                  this.fileList[1].fileList.push({
                    id: item.id,
                    url: window.g.BaseURL + 'api/upload/oss/preview?fileId=' + item.id,
                    isImage: true,
                    name: item.fileName,
                  })
                }
              })
            }
            //this.formData.noHouseFileGroupId ? this.fileList[1].groupGuid = this.formData.noHouseFileGroupId : "";
  
          }
        }
      },
      //困难家庭
      getDifficultNew: async function (idCard) {
        let params = {
          "householderName": this.JBXXform.propertyPerson,
          // "idCard": this.JBXXform.householderIdCard,
          idCard: idCard,
          "type": 0
        }
        const resp = await getDifficultFamilies(params)
        if (resp.data.data && resp.data.data.length > 0) {
          // this.JBXXform.userType = 1;
          this.JBXXform.userTypeFirst = '是'
        } else {
          // this.JBXXform.userType = 0;
          this.JBXXform.userTypeFirst = '否'
          // this.JBXXform.userTypeFirst = '是'
        }
      },
      saveData: async function (type) {
        let status = true
        let me = this;
        if (type == "submit") {
          let formArr = []
          // 房屋基本信息（自动获取）
          if (this.$refs.ruleFormHCJBXX) {
            formArr.push(this.$refs.ruleFormHCJBXX)
          }
          if (this.$refs.ruleFormJBXX) {
            formArr.push(this.$refs.ruleFormJBXX)
          }
          // 困难家庭信息
          if (this.$refs.ruleFormKNJT) {
            formArr.push(this.$refs.ruleFormKNJT)
          }
          // 闲置宅基地和房屋情况
          if (this.$refs.ruleFormXZQK) {
            formArr.push(this.$refs.ruleFormXZQK)
          }
          // 与自建房数据库关联
          if (this.$refs.ruleFormZJF) {
            formArr.push(this.$refs.ruleFormZJF)
          }
          // 鉴定整治方式
          if (this.$refs.ruleFormZZFS) {
            formArr.push(this.$refs.ruleFormZZFS)
          }
          // 排查结论
          if (this.$refs.ruleFormzp) {
            formArr.push(this.$refs.ruleFormzp)
          }
          let arr = []
          await Promise.all(formArr.map(item => item.validate().then((valid) => {
            arr.push(true)
          }).catch((error) => {
            arr.push(false)
          })))
          status = arr.every(item => {
            return item
          })
          //附件
          debugger
          if (this.formData.isHasHouse == 1) {
            this.fileList.forEach(item => {
              if (item.fileList.length == 0 && item.isHas) {
                status = false
              }
            })
          }
        }
        if (status === true) {
          this.XCZKList.forEach(element => {
            if (element.valueYC && element.valueYC.length != 0) {
              this.formData[element.key] = element.valueYC.join(",")
            } else if (element.value.length > 0) {
              this.formData[element.key] = element.value.join(",")
            }
          });
          this.KNJTform['fileGroupGuid'] = me.KNQZCLfile[0].groupGuid;
          if (me.KNJTform.userTypeOperation == '是' && me.KNJTform.userType == 1) {
            if (me.formData.isHasHouse != null) {
              if (me.KNJTform.userTypeOperation == null) {
                me.$toast.fail("请选择是否修改困难家庭!")
                return;
              }
              me.formData.userTypeOperation = '是';
              me.KNJTform.userTypeOperation = '是';
              for (let i in me.KNJTform) {
                me.KNJTform.objectNo = me.objectNo
                me.KNJTform.userName = JSON.parse(window.localStorage.getItem("userName")).userName
                me.KNJTform.userId = JSON.parse(window.localStorage.getItem("userName")).userId
                if (me.KNJTform.userType == '1') {
                  if (i !== 'fileGroupGuid') {
                    if (me.KNJTform[i] !== '') {
                    } else {
                      me.$toast.fail("请填写困难家庭信息!");
                      return false;
                    }
                  }
                }
              }
              let webResult1 = await axios.post(me.BaseURL + '/api/farmerHouse/dangerHouseRemold/saveUserTypeNewV2', me.KNJTform, {
                headers: {
                  isOutParam: true,
                },
              });
              if (webResult1.data.msg == '成功') {
                // this.$toast.success("保存成功")
              } else {
                me.$toast.fail("保存失败!")
              }
            } else {
              me.$toast.fail("请选择是否是无房户!")
              return false;
            }
          } else {
            this.formData.userTypeOperation = '否';
            this.KNJTform.objectNo = this.objectNo
            this.KNJTform.userType = 0;
            this.KNJTform.userName = JSON.parse(window.localStorage.getItem("userName")).userName
            this.KNJTform.userId = JSON.parse(window.localStorage.getItem("userName")).userId
            let webResult1 = await axios.post(this.BaseURL + '/api/farmerHouse/dangerHouseRemold/saveUserTypeNewV2', this.KNJTform, {
              headers: {
                isOutParam: true,
              },
            });
          }
          //保存现场状况
          function saveInspectInfos() {
            let parmData = me.formData
            parmData['objectNo'] = me.objectNo;
            parmData['safetyPatrolPictures'] = me.fileList[0].groupGuid;
            parmData['fileGroupId'] = me.fileList[1].groupGuid;
            delete parmData.fileGroupList;
            return new Promise((resolve, reject) => {
              axios.post(me.BaseURL + '/api/farmerHouse/houseInspect/saveInspectInfo', parmData, {
                headers: {
                  isOutParam: true,
                },
              }).then((item) => {
                resolve(item)
              })
            }).catch();
          }
          //保存房屋基本信息
          function savePatrolHouseInfos() {
            let p = {}
            for (var i in me.JBXXform) {
              if (me.JBXXform[i] === "") {
                p[i] = null
              } else {
                p[i] = me.JBXXform[i]
              }
            }
            p['objectNo'] = me.objectNo;
            p.houseDetailusage = ''
            me.houseDetailusage.map((item, i) => {
              if (i == me.houseDetailusage.length - 1) {
                p.houseDetailusage += item;
              } else {
                p.houseDetailusage += item + ",";
              }
            });
            //判断如果困难家庭大数据选择是  或者是修改困难家庭-是否是困难家庭选择是 更新主表userType字段的值
            if (me.JBXXform.houseRenovateStatus && me.JBXXform.houseRenovateStatus.length > 0) {
              p["houseRenovateStatus"] = p["houseRenovateStatus"][0]
            } else {
              p["houseRenovateStatus"] = null;
            }
            if (me.JBXXform.userTypeFirst == '否') {
              p["userTypeFirst"] = 0
            }
            if (me.JBXXform.userTypeFirst == '是') {
              p["userTypeFirst"] = 1
            }
            if(me.formData.isHasHouse){
              p["isHasHouse"]=me.formData.isHasHouse;
            }
            if (me.JBXXform.userTypeFirst == '是' || me.KNJTform.userType == 1) {
              p["userType"] = 1;
            } else {
              p["userType"] = 0;
            }
            return new Promise((resolve, reject) => {
              axios.post(me.BaseURL + '/api/farmerHouse/housePatrol/savePatrolHouseInfo', p, {
                headers: {
                  isOutParam: true,
                },
              }).then((items) => {
                resolve(items)
              })
            }).catch();
          }
          Promise.all([savePatrolHouseInfos(), saveInspectInfos()]).then(async (itemResult) => {
            if (itemResult[0].data.data && itemResult[1].data.data) {
              if (type == "submit") {
                //判断排查结论
                if ((me.formData.firstJudge == 1 || me.formData.firstJudge == 3) && me.JBXXform.checkNumber) {
                  let p = {
                    checkNumberFull: me.JBXXform.checkNumber
                  }
                  let resultByqueryList = await axios.post(me.BaseURL + `/api/farmerHouse/houseRemoldV2BaseInfo/queryList`, p, {
                    headers: {
                      isOutParam: true
                    }
                  })
                  if (resultByqueryList.data && resultByqueryList.data.data && resultByqueryList.data.data.pageList.length > 0) {
                    if (me.formData.firstJudge == 1) {
                      Dialog.confirm({
                        message: `${me.JBXXform.checkNumber}房屋已经流转到危房改造${resultByqueryList.data.data.pageList[0].processNodeName}环节，是否继续提交?`,
                      }).then(() => {
                        me.submit()
                      })
                    } else {
                      me.submit()
                    }
                  } else {
                    if (me.formData.firstJudge == 3) {
                      Dialog.confirm({ message: `${me.JBXXform.checkNumber}房屋未查询到正在整治中的记录，是否继续提交?` }).then(() => {
                        me.submit()
                      })
                    } else {
                      me.submit()
                    }
                  }
                } else {
                  me.submit()
                }
              } else {
                me.$toast.success("保存成功")
              }
            } else {
              me.$toast.fail("保存失败")
            }
          })
        } else {
          this.$toast.fail("请检查必填项必填!")
        }
      },
      //提交
      submit: async function () {
        let parm = {
          objectNo: this.objectNo,
          userName: JSON.parse(window.localStorage.getItem("userName")).userName,
          userId: JSON.parse(window.localStorage.getItem("userName")).userId
        }
        let webResult = await axios.post(this.BaseURL + '/api/farmerHouse/houseInspect/submitInspectInfo', parm, {
          headers: {
            isOutParam: true,
          },
        });
        if (webResult.data.data) {
          this.$toast.success("提交成功!")
          this.$router.go(-1)
          // if (this.$router.query.isMap) {
          //   this.$router.push({
          //     path: `/SecurityMain?citycode=${window.localStorage.getItem('citycode')}`,
          //   })
          // } else {
          //   this.$router.push({
          //     path: '/toBeCheckedList',
          //   })
          // }
        } else {
          this.$toast.fail("提交失败!")
        }
      },
      //附件
      getGroupGuids(item, list) {
        this.groupName = item.name;
        this.groupGuid = item.groupGuid;
      },
      //上传附件
      afterRead: async function (file) {
        let _this = this;
        var formData = new FormData();
        formData.append("files", file.file);
        formData.append('path', 'wg')
        formData.append("groupName", this.groupName);
        formData.append("toGroupGuid", this.groupGuid);
        const res = await ossUploadFiles(formData)
      },
      //删除附件
      delectFile: async function (file) {
        debugger
        // let fileguid = ''
        // if (file.ROW_GUID) {
        //     fileguid = file.ROW_GUID
        // } else {
        //     fileguid = this.fileGuid
        // }
        // if (fileguid) {
        //     let params = {
        //         accessCode: 'ce9b691634de4ebca68dc5bb638d07f4',
        //         cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        //         params: {
        //             fileGuid: fileguid,
        //             token: window.localStorage.getItem('token'),
        //         },
        //     }
        //     const res = await FileServerProxy(params)
        //     let data = JSON.parse(res.data.data).Success
        //     if (data) {
        //         this.$toast.success('删除成功!')
        //     }
        // }
        let arr = [];
        arr.push(file.id)
        const res = await ossdelteFiles(arr)
        this.$toast.success(res.data.msg)
      },
      //打开附件
      handlePictureCardPreview(file) {
        var url = window.g.BaseURL + 'api/upload/oss/preview?fileId=' + file.id;
        this.$router.push({
          path: '/PDFJSViewer',
          query: {
            path: url,
          },
        })
        //Eca.Window.OpenWebUrl('预览', file.url, ["85vw", "90vh"]);
      },
      //
      handleCheckedChange(item) {
        if (item.value.length > 0) {
          this.formData.firstJudge = 1
        }
        item.valueYC = []
      },
      //
      handleRadioChange(item) {
        item.value = [];
        this.XCZKList.forEach(element => {
          if (element.valueYC && element.valueYC.length != 0) {
            this.formData[element.key] = element.valueYC.join(",")
          } else {
            this.formData[element.key] = ''
          }
        });
        if (this.formData.buildEnums === '0' &&
          this.formData.baseEnums === '0' &&
          this.formData.liveBrickEnums === '0' &&
          this.formData.livePillarsEnums === '0' &&
          this.formData.liveFloorEnums === '0' &&
          this.formData.liveWoodEnums === '0') {
          this.formData.firstJudge = 0
        } else {
          this.formData.firstJudge = 1
        }
        // item.valueYC = "0"
        // this.$refs['checkboxGroup' + index][0].toggleAll(false);
      }
    },
    mounted() {
      this.getEnum()
      //网格巡查 隐藏申请人信息
      if (this.rowData.dataSource == '网格巡查' || this.rowData.reportTypeName == '网格巡查') {
          this.WGSQXX.splice(0, 1)
      }
      this.getData();
      this.getYearsToNow()
      // if(window.localStorage.getItem("userName")&&JSON.parse(
      //   window.localStorage.getItem("userName")
      // )){
      //   this.formData.inspectPerson = JSON.parse(
      //     window.localStorage.getItem("userName")
      //   ).userName
      // }
      this.formData.inspectPerson = JSON.parse(window.localStorage.getItem("userName")).userName;
      this.formData.inspectDate = this.getDate();
      // setTimeout(()=>{
      // this.getDifficultNew();
      // },1000)
      //给每个附件分组随机生成guid
      this.fileList.forEach(item => {
        item.groupGuid = this.newGuid()
      })
      this.KNQZCLfile.forEach(item => {
        item.groupGuid = this.newGuid()
      })
    }
  }
  </script>
  
  <style scoped lang="scss">
  #houseSafetyChecklist {
    width: 100%;
  
    .title {
      text-align: center;
      font-weight: bold;
      margin-bottom: 10px
    }
  
    .subTitle {
      width: 100%;
      height: 40px;
      line-height: 40px;
      font-weight: bold;
      position: relative;
      display: flex;
      align-items: center;
      padding-left: 10px;
  
      .line {
        width: 6px;
        height: 16px;
        background: #3f8ffc;
        display: inline-block;
        margin-right: 10px;
      }
    }
  
    .formValue {
      line-height: 40px;
      margin: 0 16px;
      font-size: 14px;
      color: #646566;
      border-bottom: 1px solid #ebedf0;
    }
  
    .XCZK {
      padding: 10px;
  
      .subtitle {
        font-size: 16px;
        margin: 10px 0;
      }
    }
  
  }
  </style>
  <style lang="scss">
  #houseSafetyChecklist {
    .van-field__label {
      width: auto !important;
      margin-right: 20px !important;
    }
  }
  </style>
  